
******* Master Analysis Do File *********

* set directory to main folder that contains the datasets and do-files sub-folders
global dir "ENTER DIRECTORY HERE"
cd "$dir"

set more off
ssc install rdrobust, replace
ssc install rdlocrand, replace



********************************************************** Table 1 *******************************************************************

use "$dir\datasets\NSS dataset creation\nss_64_10\data_output\merged_all_NSS_NREGA_61_64.dta", clear

drop if rank==.

keep state_name state_code dist_code nrega_pred_2 nrega_phase_1 nrega_phase_2 nrega_pred_1 rank
duplicates drop

** add diagonal numbers 0/0 and 1/1

tab nrega_phase_1 nrega_pred_1 if state_name=="Andhra Pradesh", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Assam", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Bihar", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Chhattisgarh", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Gujarat", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Haryana", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Jharkhand", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Karnataka", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Kerala", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Madhya Pradesh", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Maharashtra", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Orissa", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Punjab", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Rajasthan", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Tamilnadu", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="Uttar Pradesh", cell
tab nrega_phase_1 nrega_pred_1 if state_name=="West Bengal", cell
tab nrega_phase_1 nrega_pred_1 , cell

tab nrega_phase_2 nrega_pred_2 if state_name=="Andhra Pradesh", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Assam", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Bihar", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Chhattisgarh", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Gujarat", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Haryana", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Jharkhand", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Karnataka", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Kerala", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Madhya Pradesh", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Maharashtra", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Orissa", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Punjab", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Rajasthan", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Tamilnadu", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="Uttar Pradesh", cell
tab nrega_phase_2 nrega_pred_2 if state_name=="West Bengal", cell
tab nrega_phase_2 nrega_pred_2 , cell



********************************************************** Table 2 *******************************************************************
cd "$dir"
do 2a.analysis_sample_creation.do

sum priv_empl_ext61 fam_empl_ext61 pub_empl_ext61 daily_wage61 daily_wage_priv61 daily_wage_pub61 if state_rank_norm_2!=. & nrega_phase_2==1 & pub_empl_ext64!=.
sum priv_empl_ext61 fam_empl_ext61 pub_empl_ext61 daily_wage61 daily_wage_priv61 daily_wage_pub61 if state_rank_norm_2!=. & nrega_phase_2==0 & pub_empl_ext64!=.
 

********************************************************** Table 3, Panel A *******************************************************************
cd "$dir"
do 2a.analysis_sample_creation.do

regress pub_empl_ext64 nrega_pred_2 int_eff_2 pub_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext64 nrega_pred_2 int_eff_2 privfam_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress priv_empl_ext64 nrega_pred_2 int_eff_2 priv_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress fam_empl_ext64 nrega_pred_2 int_eff_2 fam_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)

regress pub_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 pub_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 privfam_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress priv_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 priv_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress fam_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 fam_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)

sum pub_empl_ext64 privfam_empl_ext64 priv_empl_ext64 fam_empl_ext64 if state_rank_norm_2!=.

********************************************************** Table 3, Panel B *******************************************************************
cd "$dir"
do 2a.analysis_sample_creation.do

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress pub_empl_ext64 nrega_pred_2 state_rank_norm_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)

test (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)=0

restore


preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress privfam_empl_ext64 nrega_pred_2 state_rank_norm_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)

test (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)=0

restore


preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress priv_empl_ext64 nrega_pred_2 state_rank_norm_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)

test (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)=0

restore


preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 { 
	disp `i'
	regress fam_empl_ext64 nrega_pred_2 state_rank_norm_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)

test (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)=0

restore


preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress pub_empl_ext64 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)

test (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)=0

restore


preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress privfam_empl_ext64 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)

test (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)=0

restore


preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 { 
	disp `i'
	regress priv_empl_ext64 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)

test (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)=0

restore


preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 { 
	disp `i'
	regress fam_empl_ext64 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)

test (21082989*[pubsam6_mean]nrega_pred_2+56473122*[pubsam8_mean]nrega_pred_2+166052859*[pubsam9_mean]nrega_pred_2+26638407*[pubsam18_mean]nrega_pred_2+36706920*[pubsam21_mean]nrega_pred_2+20795956*[pubsam22_mean]nrega_pred_2+60385118*[pubsam23_mean]nrega_pred_2+96752247*[pubsam27_mean]nrega_pred_2+75727541*[pubsam28_mean]nrega_pred_2+52733958*[pubsam29_mean]nrega_pred_2+31838619*[pubsam32_mean]nrega_pred_2+62110839*[pubsam33_mean]nrega_pred_2)/(21082989+56473122+166052859+82878796+26638407+80221171+26909428+36706920+20795956+60385118+96752247+75727541+52733958+31838619+62110839)=0

restore


********************************************************** Table 3, Panel C *******************************************************************
cd "$dir"
do 2b.analysis_sample_creation.do

regress pub_empl_ext64 nrega_pred_2 int_eff_2 pub_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext64 nrega_pred_2 int_eff_2 privfam_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress priv_empl_ext64 nrega_pred_2 int_eff_2 priv_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress fam_empl_ext64 nrega_pred_2 int_eff_2 fam_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)


regress pub_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 pub_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 privfam_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress priv_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 priv_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress fam_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 fam_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)

sum pub_empl_ext64 privfam_empl_ext64 priv_empl_ext64 fam_empl_ext64 if state_rank_norm_2!=. & e(sample)





********************************************************** Table 4, Panel A *******************************************************************
cd "$dir"
do 2c.analysis_sample_creation.do
do 3a.crop_sample_creation.do

regress wavprod nrega_pred_2 int_eff_2 state_rank_norm_2 state1* wavprod_2005 if dist_tag==1
regress wavyield nrega_pred_2 int_eff_2 state_rank_norm_2 state1* wavyield_2005 if dist_tag==1
regress c_wavprod nrega_pred_2 int_eff_2 state_rank_norm_2 state1* c_wavprod_2005 if dist_tag==1
regress c_wavyield nrega_pred_2 int_eff_2 state_rank_norm_2 state1* c_wavyield_2005 if dist_tag==1

regress wavprod nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* wavprod_2005 if dist_tag==1
regress wavyield nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* wavyield_2005 if dist_tag==1
regress c_wavprod nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* c_wavprod_2005 if dist_tag==1
regress c_wavyield nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* c_wavyield_2005 if dist_tag==1

sum wavprod wavyield c_wavprod c_wavyield if e(sample)==1


********************************************************** Table 4, Panel B *******************************************************************
cd "$dir"
do 2c.analysis_sample_creation.do
do 3a.crop_sample_creation.do

regress wavprod nrega_pred_2 nrega_r small_farmers int_eff_2 state_rank_norm_2 state1* wavprod_2005 if dist_tag==1
regress wavyield nrega_pred_2 nrega_r small_farmers int_eff_2 state_rank_norm_2 state1* wavyield_2005 if dist_tag==1
regress c_wavprod nrega_pred_2 nrega_r small_farmers int_eff_2 state_rank_norm_2 state1* c_wavprod_2005 if dist_tag==1
regress c_wavyield nrega_pred_2 nrega_r small_farmers int_eff_2 state_rank_norm_2 state1* c_wavyield_2005 if dist_tag==1

regress wavprod nrega_pred_2 nrega_r small_farmers int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* wavprod_2005 if dist_tag==1
regress wavyield nrega_pred_2 nrega_r small_farmers int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* wavyield_2005 if dist_tag==1
regress c_wavprod nrega_pred_2 nrega_r small_farmers int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* c_wavprod_2005 if dist_tag==1
regress c_wavyield nrega_pred_2 nrega_r small_farmers int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* c_wavyield_2005 if dist_tag==1



********************************************************** Table 5, Panel A *******************************************************************
cd "$dir"
do 2a.analysis_sample_creation.do

regress log_daily_wage64 nrega_pred_2 int_eff_2 log_daily_wage61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress log_daily_wage_priv64 nrega_pred_2 int_eff_2 log_daily_wage_priv61 state_rank_norm_2 state1*, vce(cluster state_dist)

regress log_daily_wage64 nrega_pred_2 int_eff_2 int_sq_2 log_daily_wage61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
sum log_daily_wage64 if state_rank_norm_2!=. & e(sample)==1

regress log_daily_wage_priv64 nrega_pred_2 int_eff_2 int_sq_2 log_daily_wage_priv61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
sum log_daily_wage_priv64 if state_rank_norm_2!=. & e(sample)==1



********************************************************** Table 5, Panel B *******************************************************************
cd "$dir"
do 2a.analysis_sample_creation.do

regress pub_empl_ext64 nrega_pred_2 nrega_star star_state int_eff_2 pub_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)

regress pub_empl_ext64 nrega_pred_2 nrega_star star_state int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1* pub_empl_ext61, vce(cluster state_dist)

sum pub_empl_ext64 if state_rank_norm_2!=.




********************************************************** Figure 1 *******************************************************************
cd "$dir"
use "$dir\datasets\NSS dataset creation\nss_64_10\data_output\merged_all_NSS_NREGA_61_64.dta", clear

drop if rank==.

keep state_name state_code dist_code nrega_pred_2 nrega_phase_1 nrega_phase_2 nrega_pred_1 rank comp_index
duplicates drop

sort state_code dist_code

* Distribution of Index: Phase 2 vs Phase 3
twoway (scatter comp_index state_rank_norm_2 if state_code==3) (scatter comp_index state_rank_norm_2 if state_code==6) (scatter comp_index state_rank_norm_2 if state_code==8) (scatter comp_index state_rank_norm_2 if state_code==9) (scatter comp_index state_rank_norm_2 if state_code==10) (scatter comp_index state_rank_norm_2 if state_code==18) (scatter comp_index state_rank_norm_2 if state_code==19) (scatter comp_index state_rank_norm_2 if state_code==20) (scatter comp_index state_rank_norm_2 if state_code==21) (scatter comp_index state_rank_norm_2 if state_code==22) (scatter comp_index state_rank_norm_2 if state_code==23) (scatter comp_index state_rank_norm_2 if state_code==24) (scatter comp_index state_rank_norm_2 if state_code==27) (scatter comp_index state_rank_norm_2 if state_code==28) (scatter comp_index state_rank_norm_2 if state_code==29) (scatter comp_index state_rank_norm_2 if state_code==32) (scatter comp_index state_rank_norm_2 if state_code==33), xline(0) xtitle(Normalized State Rank Phase 2) ytitle(Planning Commission Index) legend(off) scheme(s2mono) graphregion(color(white))
graph export figure_1a.eps, replace 

* Phase 2 first stage graph
preserve
egen bins1=cut(state_rank_norm_2), at(-20(1)42)
collapse(mean) nrega_phase_2 state_rank_norm_2, by(bins1)
twoway (qfitci nrega_phase_2 bins1 if bins1<=0, ciplot(rline)) (qfitci nrega_phase_2 bins1 if bins1>0, ciplot(rline))(scatter nrega_phase_2 bins1), ylabel(0 0.2 0.4 0.6 0.8 1) legend(order(1 "95% Confidence Interval"  4 "Phase 2 NREGS Probability"  )) xtitle(Normalized State Rank Phase 2) scheme(s2mono) graphregion(color(white))
graph export figure_1b.eps, replace 
restore


********************************************************** Figure 2 *******************************************************************
cd "$dir"
do 2a.analysis_sample_creation.do

preserve
regress pub_empl_ext64 pub_empl_ext61 state1*
predict pub_empl_ext64_r if pub_empl_ext64!=. & pub_empl_ext61!=., residuals
regress state_rank_norm_2 pub_empl_ext61  state1* if pub_empl_ext64!=. & pub_empl_ext61!=.
predict state_rank_norm_2_r if pub_empl_ext64!=. & pub_empl_ext61!=., residuals

collapse (mean) pub_empl_ext* state1* state_rank_norm_2_r, by(state_rank_norm_2)
rdplot pub_empl_ext64_r state_rank_norm_2_r, c(+0.5) p(2) binselect(qsmv) graph_options(legend(off) xtitle(Normalized State Rank) scheme(s2mono) graphregion(color(white)))
graph export figure_2a.eps, replace
restore	


preserve
regress privfam_empl_ext64 privfam_empl_ext61 state1*
predict privfam_empl_ext64_r if privfam_empl_ext64!=. & privfam_empl_ext61!=., residuals
regress state_rank_norm_2 privfam_empl_ext61  state1* if privfam_empl_ext64!=. & privfam_empl_ext61!=.
predict state_rank_norm_2_r if privfam_empl_ext64!=. & privfam_empl_ext61!=., residuals

collapse (mean) privfam_empl_ext* state1* state_rank_norm_2_r, by(state_rank_norm_2)
rdplot privfam_empl_ext64_r state_rank_norm_2_r, c(+0.5) p(2) binselect(qsmv) graph_options(legend(off) xtitle(Normalized State Rank) scheme(s2mono) graphregion(color(white)))
graph export figure_2b.eps, replace
restore


preserve
regress priv_empl_ext64 priv_empl_ext61 state1*
predict priv_empl_ext64_r if priv_empl_ext64!=. & priv_empl_ext61!=., residuals
regress state_rank_norm_2 priv_empl_ext61  state1* if priv_empl_ext64!=. & priv_empl_ext61!=.
predict state_rank_norm_2_r if priv_empl_ext64!=. & priv_empl_ext61!=., residuals

collapse (mean) priv_empl_ext* state1* state_rank_norm_2_r, by(state_rank_norm_2)
rdplot priv_empl_ext64_r state_rank_norm_2_r, c(+0.5) p(2) binselect(qsmv) graph_options(legend(off) xtitle(Normalized State Rank) scheme(s2mono) graphregion(color(white)))
graph export figure_2c.eps, replace
restore


preserve
regress fam_empl_ext64 fam_empl_ext61 state1*
predict fam_empl_ext64_r if fam_empl_ext64!=. & fam_empl_ext61!=., residuals
regress state_rank_norm_2 fam_empl_ext61  state1* if fam_empl_ext64!=. & fam_empl_ext61!=.
predict state_rank_norm_2_r if fam_empl_ext64!=. & fam_empl_ext61!=., residuals

collapse (mean) fam_empl_ext* state1* state_rank_norm_2_r, by(state_rank_norm_2)
rdplot fam_empl_ext64_r state_rank_norm_2_r, c(+0.5) p(2) binselect(qsmv) graph_options(legend(off) xtitle(Normalized State Rank) scheme(s2mono) graphregion(color(white)))
graph export figure_2d.eps, replace			
restore		






********************************************************** Table A.1 *******************************************************************
cd "$dir"
do 2d.analysis_sample_creation.do

regress pub_empl_ext61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress priv_empl_ext61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress fam_empl_ext61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress log_daily_wage_priv61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress prim61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress upper_prim61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress sec61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress land61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress log_pc_exp61 nrega_pred_2 state_rank_norm_2 state1*, vce(cluster state_dist)


regress pub_empl_ext61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress priv_empl_ext61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress fam_empl_ext61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress log_daily_wage_priv61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress prim61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress upper_prim61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress sec61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress land61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)
regress log_pc_exp61 nrega_pred_2 int_eff_2 state_rank_norm_2 state1*, vce(cluster state_dist)


regress pub_empl_ext61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress priv_empl_ext61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress fam_empl_ext61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress log_daily_wage_priv61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress prim61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress upper_prim61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress sec61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress land61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress log_pc_exp61 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)


regress pub_empl_ext61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress priv_empl_ext61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress fam_empl_ext61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress log_daily_wage_priv61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress prim61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress upper_prim61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress sec61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress land61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress log_pc_exp61 nrega_pred_2 int_eff_2 int_sq_2 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)


sum pub_empl_ext64 privfam_empl_ext64 priv_empl_ext64 fam_empl_ext64 log_daily_wage_priv61 prim61 upper_prim61 sec61 land61 log_pc_exp61 if state_rank_norm_2!=.


********************************************************** Table A.2, Panel A *******************************************************************
cd "$dir"
do 2a.analysis_sample_creation.do

regress pub_empl_ext64 nrega_pred_2 pub_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext64 nrega_pred_2 privfam_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress priv_empl_ext64 nrega_pred_2 priv_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress fam_empl_ext64 nrega_pred_2 fam_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)

regress pub_empl_ext64 nrega_pred_2 pub_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext64 nrega_pred_2 privfam_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress priv_empl_ext64 nrega_pred_2 priv_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress fam_empl_ext64 nrega_pred_2 fam_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)

sum pub_empl_ext64 privfam_empl_ext64 priv_empl_ext64 fam_empl_ext64 if state_rank_norm_2!=.


********************************************************** Table A.2, Panel B *******************************************************************
cd "$dir"
do 2a.analysis_sample_creation.do

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress pub_empl_ext64 nrega_pred_2 state_rank_norm_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15

test ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15=0

restore

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress privfam_empl_ext64 nrega_pred_2 state_rank_norm_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15

test ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15=0

restore

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress priv_empl_ext64 nrega_pred_2 state_rank_norm_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15

test ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15=0

restore

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress fam_empl_ext64 nrega_pred_2 state_rank_norm_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15

test ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15=0

restore

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress pub_empl_ext64 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15

test ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15=0

restore

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress privfam_empl_ext64 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15

test ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15=0

restore

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress priv_empl_ext64 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15

test ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15=0

restore

preserve
estimates clear

foreach i in 6 8 9 18 21 22 23 27 28 29 32 33 {
	disp `i'
	regress fam_empl_ext64 nrega_pred_2 state_rank_norm_2 state_rank_norm_sq_2 if state_code==`i'
	estimates store pubsam`i'
}

suest pubsam*, vce(cluster state_dist)

disp ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15

test ([pubsam6_mean]nrega_pred_2+[pubsam8_mean]nrega_pred_2+[pubsam9_mean]nrega_pred_2+[pubsam18_mean]nrega_pred_2+[pubsam21_mean]nrega_pred_2+[pubsam22_mean]nrega_pred_2+[pubsam23_mean]nrega_pred_2+[pubsam27_mean]nrega_pred_2+[pubsam28_mean]nrega_pred_2+[pubsam29_mean]nrega_pred_2+[pubsam32_mean]nrega_pred_2+[pubsam33_mean]nrega_pred_2)/15=0

restore




********************************************************** Table A.3 *******************************************************************
cd "$dir"
do 2e.analysis_sample_creation.do

regress pub_empl_ext64 nrega_pred_2 int_eff_2 pub_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext64 nrega_pred_2 int_eff_2 privfam_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress priv_empl_ext64 nrega_pred_2 int_eff_2 priv_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)
regress fam_empl_ext64 nrega_pred_2 int_eff_2 fam_empl_ext61 state_rank_norm_2 state1*, vce(cluster state_dist)

regress pub_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 pub_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress privfam_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 privfam_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress priv_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 priv_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)
regress fam_empl_ext64 nrega_pred_2 int_eff_2 int_sq_2 fam_empl_ext61 state_rank_norm_2 state_rank_norm_sq_2 state1*, vce(cluster state_dist)

sum pub_empl_ext64 privfam_empl_ext64 priv_empl_ext64 fam_empl_ext64 if state_rank_norm_2!=.



********************************************************** Table A.4 *******************************************************************
cd "$dir"
do 2d.analysis_sample_creation.do

preserve
keep if state_rank_norm_2>=-2 & state_rank_norm_2<=4
gen dummy = 1 if nrega_pred_2==0
replace dummy = 0 if nrega_pred_2==1

balancetable dummy pub_empl_ext61 priv_empl_ext61 fam_empl_ext61 log_daily_wage_priv61 log_pc_exp61 land61 using "balancetable61.tex", vce(cluster state_dist) replace ctitles("Phase 2" "Phase 3")

restore

********************************************************** Table A.5 *******************************************************************
cd "$dir"
do 2d.analysis_sample_creation.do

preserve
drop if state_rank_norm_2<-2 | state_rank_norm_2>4

bootstrap, cluster(state_dist) idcluster(new) seed(22) reps(1000): rdrandinf pub_empl_ext64 state_rank_norm_2, cutoff(1) fuzzy(nrega_phase_2 tsls) reps(1000) wl(-2) wr(4)
bootstrap, cluster(state_dist) idcluster(new) seed(22) reps(1000): rdrandinf privfam_empl_ext64 state_rank_norm_2, cutoff(1) fuzzy(nrega_phase_2 tsls) reps(1000) wl(-2) wr(4)
bootstrap, cluster(state_dist) idcluster(new) seed(22) reps(1000): rdrandinf priv_empl_ext64 state_rank_norm_2, cutoff(1) fuzzy(nrega_phase_2 tsls) reps(1000) wl(-2) wr(4)
bootstrap, cluster(state_dist) idcluster(new) seed(22) reps(1000): rdrandinf fam_empl_ext64 state_rank_norm_2, cutoff(1) fuzzy(nrega_phase_2 tsls) reps(1000) wl(-2) wr(4)

sum pub_empl_ext64 privfam_empl_ext64 priv_empl_ext64 fam_empl_ext64 if e(sample)==1

restore






********************************************************** Figure A.1 *******************************************************************
cd "$dir"
use "$dir\datasets\NSS dataset creation\nss_64_10\data_output\merged_all_NSS_NREGA_61_64.dta", clear

drop if rank==.

keep state_name state_code dist_code nrega_pred_2 nrega_phase_1 nrega_phase_2 nrega_pred_1 rank comp_index
duplicates drop
keep comp_index rank

twoway (scatter comp_index rank), xtitle(Planning Commission Rank) ytitle(Planning Commission Index) legend(off) scheme(s2mono) graphregion(color(white))
graph export figure_appendix1.eps, replace



********************************************************** Figure A.2 *******************************************************************
cd "$dir"
do 2d.analysis_sample_creation.do

rdwinselect state_rank_norm_2 pub_empl_ext61 priv_empl_ext61 fam_empl_ext61, cutoff(1) seed(22) statistic(ttest) reps(1000) level(.15) plot graph_options(scheme(s2mono) graphregion(color(white)) xtitle(window length/2) ytitle(minimum p-value from covariate test))
graph export figure_appendix2.eps, replace



